const debounce = (fn, delay, immediate = false) => {
    let timer = null
    let isInvoke = false
    return (...rest) => {
        if (timer) clearTimeout(timer)
        if (immediate && !isInvoke) {
            fn.apply(this, rest)
            isInvoke = true
        }else {
            timer = setTimeout(() => {
                fn.apply(this, rest)
                isInvoke = false
            }, delay)
        }
    }
}
const setRescale = () => {
    document.body.style.transform = `scale(${window.innerWidth / 1920}, ${window.innerHeight / 1080})`
}
setRescale()
window.addEventListener('resize', debounce(setRescale, 200, true))
